<?php
/**
 * Created by PhpStorm.
 * User: tt
 * Date: 2017/12/29
 * Time: 15:15
 */

namespace app\admin\model;
use think\Model;
use think\Cache;

class Excel extends Model
{
    public function getStatusTextAttr($value,$data)
    {
        $status = [1=>'<span class="label label-success">正常</span>',0=>'<span class="label label-danger">禁用</span>'];
        return $status[$data['status']];
    }

    /**
     * 获取所有的类别
     * @return array|mixed
     * @author: Huang
     */
    public function getAllExcel(){
        $data = Cache::tag('Excel')->get('Exceldata');
        if(!$data){
            $data=$this->column('title','id');
            Cache::tag('Excel')->set('Exceldata',$data);
        }
        return $data;
    }
}